package com.bosicloud.cmb.ibp.aws.adapter.commom.dto;

import com.amazonaws.services.ecs.model.KeyValuePair;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.List;

/**
 * @author Jack Peng / ziliang.peng@bosicloud.com
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DeployeAppParamDTO {

    @NotBlank(message = "AccessKey 不能为空")
    String accessKey;

    @NotBlank(message = "SecretKey 不能为空")
    String secretKey;

    /**
     * AWS区域
     */
    @NotBlank(message = "Region 不能为空")
    String region;

    /**
     * 任务名称
     */
    @Length(max = 16)
    @NotBlank(message = "taskName 不能为空")
    String taskName;

    /**
     * Memory
     */
    @NotNull
    @Min(128)
    @Max(1024 * 64)
    Integer memory;

    /**
     * CPU
     */
    @NotNull
    @Min(10)
    @Max(1024 * 8)
    Integer cpu;

    /**
     * Image
     */
    @NotBlank(message = "Image 不能为空")
    String image;

    /**
     * CheckHealthPath
     */
    @NotBlank(message = "CheckHealthPath 不能为空")
    String checkHealthPath;

    @NotBlank(message = "VPC ID 不能为空")
    String vpcId;

    @NotBlank(message = "elbArn 不能为空")
    String elbArn;

    @NotBlank(message = "ECS ClusterName 不能为空")
    String ecsClusterName;

    @Pattern(regexp = "^/.*", message = "部署路径必须以/开头")
    @NotBlank(message = "Deploy Path 不能为空")
    String deployPath;

    /**
     * ContainerPort
     */
    @NotNull
    @Min(1)
    @Max(65535)
    Integer containerPort;

    /**
     * ELB Port
     */
    @NotNull
    @Min(1)
    @Max(65535)
    Integer elbPort;

    @NotNull
    @Min(1)
    @Max(100)
    Integer instanceNum;


    @NotNull
    @Min(10)
    @Max(60)
    Integer healthCheckTimeout;

    @NotBlank(message = "日志组不能为空.")
    String logGroup;

    @NotBlank(message = "ECS Role ARN不能为空.")
    String ecsRoleArn;

    String taskRoleArn;

    List<KeyValuePair> environment;

}
